var should = require('should');
var async = require('async');
var taskHandler = require('../../../app/servers/user/handler/taskHandler');
var config = require('../../config');
var PlayerManager = require('../../../app/libs/playerManager');
var analyze = require('kc-analyze');
var checkModel = require('../../../app/models/checkModel');
var configUtil = require('../../../app/util/configUtil');

suite('测试taskHandler', function () {
    var player_manager = new PlayerManager(config.role_id);
    setup(function (done) {
        async.waterfall(
            [
                function (cb) {
                    player_manager.getAllModel(cb);
                },
                function (cb) {
                    // player_manager.task.complete_task_list = [];
                    // player_manager.task.static_list = {
                    //     101: {
                    //         10101: 10
                    //     }
                    // };
                    // player_manager.task.addTask(20001);
                    cb();
                },
                function (cb) {
                    player_manager.save(cb);
                }
            ],
            function (err) {
                done();
            }
        );
    });

    setup(function (done) {
        var analyze_config = configUtil.load('analyze');
        var game_config = configUtil.load('game');
        analyze.initialize({
            host: analyze_config.host,
            server_id: game_config.server_id
        });
    });

    suite('reward', function () {
        test('获取任务奖励', function (done) {
            var msg = {
                task_id: 200001
            };
            var session = {};

            session.uid = config.role_id;
            var task_handler = new taskHandler();
            task_handler.reward(msg, session, function (err, res) {
                done();
            });
        });

        //     test('获取任务奖励', function (done) {
        //         var msg = {
        //             task_id: 200001
        //         };
        //         var session = {};

        //         session.uid = config.role_id;
        //         var task_handler = new taskHandler();
        //         task_handler.reward(msg, session, function (err, res) {
        //             done();
        //         });
        //     });
    });
});
